﻿''' <summary>Generic Journal schema</summary>
Public Class Journal
    Inherits Indexable


    Public Sub New(ByVal content As String, ByVal format As IndexFormats, ByVal uri As String, ByVal last_modified_time As Date)
        MyBase.New(content, format)
        Me._uri = uri
        Me._last_modified_time = last_modified_time
    End Sub




    ''' <summary>Unique identifier </summary>
    ''' <remarks> required  </remarks>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _uri As String
    ''' <summary>Time last modified </summary>
    ''' <remarks> required  </remarks>
    Private _last_modified_time As Date



    ''' <summary>Title </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _title As String
    ''' <summary>Folder name </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _folder_name As String
    ''' <summary>Journal company </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _company As String
    ''' <summary>Journal categories </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _categories As String
    ''' <summary>Journal start time </summary>
    Private _start_time As Date
    ''' <summary>Journal duration (in minutes) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _duration As Integer
    ''' <summary>Journal type </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _type As String



    ''' <summary>Journal categories </summary>
    Public Property Categories() As String
        Get
            Return _categories
        End Get
        Set(ByVal value As String)
            _categories = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Journal company </summary>
    Public Property Company() As String
        Get
            Return _company
        End Get
        Set(ByVal value As String)
            _company = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Journal duration (in minutes) </summary>
    Public Property Duration() As Integer
        Get
            Return _duration
        End Get
        Set(ByVal value As Integer)
            _duration = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Folder name </summary>
    Public Property Folder_name() As String
        Get
            Return _folder_name
        End Get
        Set(ByVal value As String)
            _folder_name = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Time last modified </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Last_modified_time() As Date
        Get
            Return _last_modified_time
        End Get
    End Property
    ''' <summary>Journal start time </summary>
    Public Property Start_time() As Date
        Get
            Return _start_time
        End Get
        Set(ByVal value As Date)
            _start_time = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Title </summary>
    Public Property Title() As String
        Get
            Return _title
        End Get
        Set(ByVal value As String)
            _title = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Journal type </summary>
    Public Property Type() As String
        Get
            Return _type
        End Get
        Set(ByVal value As String)
            _type = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Unique identifier </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Uri() As String
        Get
            Return _uri
        End Get
    End Property


    Protected Overrides Sub AddRequredProperties(ByVal e As [Event])
        MyBase.AddRequredProperties(e)


        e.AddProperty("uri", Me._uri)
        e.AddProperty("last_modified_time", Me._last_modified_time.ToOADate)

    End Sub

    Protected Overrides Sub AddOtherProperties(ByVal e As [Event])
        MyBase.AddOtherProperties(e)


        If Not String.IsNullOrEmpty(_title) Then e.AddProperty("title", _title)
        If Not String.IsNullOrEmpty(_folder_name) Then e.AddProperty("folder_name", _folder_name)
        If Not String.IsNullOrEmpty(_company) Then e.AddProperty("company", _company)
        If Not String.IsNullOrEmpty(_categories) Then e.AddProperty("categories", _categories)

        e.AddProperty("start_time", Me._start_time.ToOADate)
        e.AddProperty("duration", Me._duration)

        If Not String.IsNullOrEmpty(_type) Then e.AddProperty("type", _type)

    End Sub




End Class

